home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 4 / Amiga Tools 4.iso / tools / netzwerk / parnet / test / defs.h next >
C/C++ Source or Header  |  1996-02-26  |  3KB  |  131 lines

  1.  
  2. /*
  3.  *  DEFS.H
  4.  *
  5.  *  ---- NOTE, ONLY IOREQUEST STRUCTURE IS PUBLIC, ALL OTHER STRUCTURES
  6.  *     **WILL** CHANGE WITHOUT NOTICE ----
  7.  */
  8.  
  9. #define PARNET_SRC
  10.  
  11. #include <devices/trackdisk.h>
  12. #include <devices/timer.h>
  13. #include <hardware/intbits.h>
  14. #include <exec/exec_protos.h>
  15. #include <exec/errors.h>
  16. #include <exec/interrupts.h>
  17. #include <dos.h>
  18. #include <clib/dos_protos.h>
  19. #include <stdio.h>
  20. #include <stdlib.h>
  21. #include <string.h>
  22.  
  23. #define PORTNAME    "parnet.cfg"
  24.  
  25. #define MAXPKTSIZE  (8192+256)
  26.  
  27. #define IOF_QUEUED  0x02
  28. #define IOF_RUN     0x04
  29.  
  30. #define STRM_RESERVE    0x8000        /*    ports reserved for stream protocol */
  31. #define STRM_PORTS    512        /*    must be factor of 32           */
  32.  
  33. typedef unsigned char    ubyte;
  34. typedef unsigned short    uword;
  35. typedef unsigned long    ulong;
  36.  
  37. typedef struct Library    LIB;
  38. typedef struct MsgPort    PORT;
  39. typedef struct List    LIST;
  40. typedef struct Node    NODE;
  41. typedef struct MinNode    MNODE;
  42. typedef struct Task    Task;
  43. typedef struct Message    Message;
  44.  
  45. typedef struct timerequest IOT;
  46.  
  47. typedef long (*func_ptr)();
  48. typedef void (*func_void)();
  49.  
  50. typedef struct {
  51.     LIB     Lib;        /*    library node        */
  52.     ubyte   ParAddress;     /*    1-255            */
  53.     PORT    Port;        /*    task port        */
  54.     long    PLock[2];        /*    task lock        */
  55.     LIST    UnitList;        /*    active units (ports)    */
  56. } Device;
  57.  
  58. /*
  59.  *  Unit Core Structure (not user accessable) (do not access!)
  60.  */
  61.  
  62. typedef struct {
  63.     NODE    Node;        /*    link node   DO NOT MOVE */
  64.     func_void BeginIO;        /*    begin I/O   DO NOT MOVE */
  65.     func_void AbortIO;        /*    abort I/O   DO NOT MOVE */
  66.     func_void CloseFunc;
  67.     func_void DataFunc;     /*    low level packet data    */
  68.     uword   RefCnt;
  69.     uword   Port;        /*    core port ident     */
  70.     uword   Protocol;        /*    protocol id        */
  71.     ulong   DestAddr;        /*    destination  0 = self    */
  72.     uword   Flags;        /*    status flags        */
  73.     uword   State;        /*    (protocol private)      */
  74.     long    UnitLock[2];
  75.     LIST    PendIOR;        /*    pending read requests        */
  76.     LIST    PendIOW;        /*    pending write requests        */
  77.     LIST    PendCon;        /*    pending connect requests    */
  78.     LIST    PendLsn;        /*    pending listen requests     */
  79. } Unit;
  80.  
  81. /*
  82.  *  Io request structure and user defines
  83.  */
  84.  
  85. #include "devices/parnet.h"
  86.  
  87. typedef IOParReq    Iob;
  88.  
  89. /*
  90.  *  A low level network packet
  91.  */
  92.  
  93. typedef struct {
  94.     Message Msg;
  95.     Iob     *iob;            /*    IO req (unit_str)       */
  96.     Unit    *io_Unit;            /*    unit involved        */
  97.     ubyte   DestAddr;            /*    Destination machine    */
  98.     ubyte   Reserved;
  99.     uword   DestPort;            /*    Destination port no.    */
  100.     ulong   DLen1;            /*    Data Length        */
  101.     ulong   DLen2;            /*    Data Length        */
  102.     ubyte   *Data1;            /*    Data Pointer (lw algn)  */
  103.     ubyte   *Data2;            /*    Data Pointer (lw algn)  */
  104. } Packet;
  105.  
  106. /*
  107.  *  private public port to remember addr across closes.
  108.  */
  109.  
  110. typedef struct {
  111.     PORT    Port;
  112.     long    Address;
  113.     long    Timeout;
  114.     char    DebugBuf[32];
  115. } PubPort;
  116.  
  117. /*
  118.  *  Globals
  119.  */
  120.  
  121. extern long    ParLLTimeout;        /*    par.asm */
  122. extern Device    *DevBase;
  123. extern PubPort    *StickyPort;
  124.  
  125. extern Unit    *FindUnitForPort();
  126. extern Unit    *AllocUnit();
  127. extern Packet    *AllocParPacket();
  128. extern void    ReadConfig();
  129. extern void    WriteConfig();
  130.  
  131.